/**
 *    Copyright 2015 the original author or authors.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */
package org.mybatis.caches.redis;

import redis.clients.jedis.JedisPoolConfig;
import redis.clients.jedis.Protocol;

public class RedisConfig extends JedisPoolConfig {
	private String cache4SystemName = "mybatis-redis";
	private String host = Protocol.DEFAULT_HOST;
	private int port = Protocol.DEFAULT_PORT;
	private String address = "localhost:6379";
	private int deployType = 0;
	private int connectionTimeout = Protocol.DEFAULT_TIMEOUT;
	private int soTimeout = Protocol.DEFAULT_TIMEOUT;
	private String password = null;
	private int database = Protocol.DEFAULT_DATABASE;
	private String clientName = null;
	private long keyMaxLiveMinutes = 480 * 60 * 1000;

	public String getHost() {
		return this.host;
	}

	public void setHost(String host) {
		if (host != null && !"".equals(host)) {
			this.host = host;
		}
	}

	public int getPort() {
		return this.port;
	}

	public void setPort(int port) {
		this.port = port;
	}

	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		if (password != null && !"".equals(password)) {
			this.password = password;
		}
	}

	public int getDatabase() {
		return this.database;
	}

	public void setDatabase(int database) {
		this.database = database;
	}

	public String getClientName() {
		return this.clientName;
	}

	public void setClientName(String clientName) {
		if (clientName != null && "".equals(clientName)) {
			this.clientName = clientName;
		}
	}

	public int getConnectionTimeout() {
		return this.connectionTimeout;
	}

	public void setConnectionTimeout(int connectionTimeout) {
		this.connectionTimeout = connectionTimeout;
	}

	public int getSoTimeout() {
		return this.soTimeout;
	}

	public void setSoTimeout(int soTimeout) {
		this.soTimeout = soTimeout;
	}

	/**
	 * @return the deployType
	 * @author A18ccms a18ccms_gmail_com
	 * @date 2017年5月15日 下午12:20:12
	 */
	public int getDeployType() {
		return this.deployType;
	}

	/**
	 * @author A18ccms a18ccms_gmail_com
	 * @date 2017年5月15日 下午12:20:12
	 * @param deployType the deployType to set
	 */
	public void setDeployType(int deployType) {
		this.deployType = deployType;
	}

	/**
	 * @return the address
	 * @author A18ccms a18ccms_gmail_com
	 * @date 2017年5月15日 下午12:24:24
	 */
	public String getAddress() {
		return this.address;
	}

	/**
	 * @author A18ccms a18ccms_gmail_com
	 * @date 2017年5月15日 下午12:24:24
	 * @param address the address to set
	 */
	public void setAddress(String address) {
		this.address = address;
	}

	/**
	 * @return the cache4SystemName
	 * @author chengcai.shang@cmgplex.com
	 * @date 2021年3月26日 上午11:16:17
	 */
	public String getCache4SystemName() {
		return this.cache4SystemName;
	}

	/**
	 * @author chengcai.shang@cmgplex.com
	 * @date 2021年3月26日 上午11:16:17
	 * @param cache4SystemName the cache4SystemName to set
	 */
	public void setCache4SystemName(String cache4SystemName) {
		this.cache4SystemName = cache4SystemName;
	}

	/**
	 * @return the keyMaxLiveMinutes
	 * @author chengcai.shang@cmgplex.com
	 * @date 2024年8月30日 下午1:56:30
	 */
	public long getKeyMaxLiveMinutes() {
		return this.keyMaxLiveMinutes;
	}

	/**
	 * @author chengcai.shang@cmgplex.com
	 * @date 2024年8月30日 下午1:56:30
	 * @param keyMaxLiveMinutes the keyMaxLiveMinutes to set
	 */
	public void setKeyMaxLiveMinutes(long keyMaxLiveMinutes) {
		this.keyMaxLiveMinutes = keyMaxLiveMinutes;
	}

	/*
	 * (非 Javadoc) <p>Title: toString</p> <p>Description: </p>
	 * 
	 * @return
	 * 
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "RedisConfig [cache4SystemName=" + this.cache4SystemName + ", host=" + this.host + ", port=" + this.port
				+ ", address=" + this.address + ", deployType=" + this.deployType + ", connectionTimeout="
				+ this.connectionTimeout + ", soTimeout=" + this.soTimeout + ", password=" + this.password
				+ ", database=" + this.database + ", clientName=" + this.clientName + ", keyMaxLiveMinutes="
				+ this.keyMaxLiveMinutes + "]";
	}
}
